package com.kevin.file.feign.fallback;

import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import com.kevin.file.feign.FileFeign;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class FileFeignFallback implements FallbackFactory<FileFeign>{

	@Override
	public FileFeign create(Throwable cause) {
		return new FileFeign() {
			@Override
			public String fileUpload(MultipartFile file) {
				log.error("Upload file fail: ", cause.toString());
				return "Upload file fail!";
			}
		};
	}

}
